/*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/

var windowIndex = 0;

Ext.define('MyDesktop.BogusModule', {
    extend: 'Ext.ux.desktop.Module',

    init: function () {
        this.launcher = {
            text: 'Window ' + (++windowIndex),
            iconCls: 'bogus',
            handler: this.createWindow,
            scope: this,
            windowId: windowIndex
        };
    },

    createWindow: function (src) {
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('bogus' + src.windowId);
        if (!win) {
            win = desktop.createWindow({
                id: 'bogus' + src.windowId,
                title: src.text,
                width: 640,
                height: 480,
                html: '<p>Something useful would be in here.</p>',
                iconCls: 'bogus',
                animCollapse: false,
                constrainHeader: true
            });
        }
        win.show();
        return win;
    }
});

/*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/

Ext.define('MyDesktop.BogusMenuModule', {
    extend: 'MyDesktop.BogusModule',

    init: function () {

        this.launcher = {
            text: 'More items',
            iconCls: 'bogus',
            handler: function () {
                return false;
            },
            menu: {
                items: []
            }
        };

        for (var i = 0; i < 5; ++i) {
            this.launcher.menu.items.push({
                text: 'Window ' + (++windowIndex),
                iconCls: 'bogus',
                handler: this.createWindow,
                scope: this,
                windowId: windowIndex
            });
        }
    }
});